﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList list = new SortedList();

            list.Add(1,"天堂");
            list.Add(10, "地狱");
            list.Add(5, "人间");
            
            foreach (DictionaryEntry a in list)
            {
                var key = a.Key;
                var value = a.Value;

                Console.WriteLine("{0} {1}",key,value);
            }

            var c = list.ContainsKey(5);
            if (c)
            {
                Console.WriteLine("存在键为5的值");
            }
            else
            {
                Console.WriteLine("不存在键为5的值");
            }

            var b = list.ContainsValue("上帝");
            if (b)
            {
                Console.WriteLine("存在值为上帝的值");
            }
            else
            {
                Console.WriteLine("不存在值为上帝的值");
            }

            list.Clear();
        }
    }
}
